<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>11.props_confine</title>
</head>
<body>
<div id="app"></div>
<div id="app1"></div>
<div id="app2"></div>

<script src="lib/react.development.js"></script>
<script src="lib/react-dom.development.js"></script>
<script src="lib/babel.min.js"></script>
<script src="lib/prop-types.js"></script>

<script type="text/babel">
   class Student extends React.Component{
       static defaultProps ={
           username: 'xxx'
       }

       static propTypes ={
           username:PropTypes.string,
           age:PropTypes.number,
           gender:PropTypes.string
       }

       render(){
           const {username,age,gender} =this.props;
           return(
               <ul>
                   <li>{username}</li>
                   <li>{age}</li>
                   <li>{gender}</li>
               </ul>
           )
       }
   }

   const  user1 ={
       username: "Lucy",
       age:29,
       gender: "Girl"
   }

   const  user2 ={
       age:12,
       gender: "Girl"
   }

   const  user3 ={
       username: "Lucy",
       age:"chvj",
       gender: "Girl"
   }
        ReactDOM.render(<Student {...user1}/>,document.getElementById("app"))
        ReactDOM.render(<Student {...user2}/>,document.getElementById("app1"))
        ReactDOM.render(<Student {...user3}/>,document.getElementById("app2"))
</script>
</body>
</html>